package nl.utwente.eemcs.graph;

/**
 * Partition is a composite node, in which a subgraph can be defined
 * @author Evert Duipmans
 */
public class Partition extends CompositeNode<Node, Node> {
	/**
	 * Inner graph of the partition
	 */
	protected Graph innerGraph;
	
	/**
	 * Create a new partition
	 * @param name Name of the partition
	 */
	public Partition(String name) {
		super(name);
		this.innerGraph = new Graph();
	}

	/**
	 * Get the inner graph of the partition
	 * @return Inner graph
	 */
	public Graph getInnerGraph() {
		return innerGraph;
	}

	/**
	 * Set the internal graph of the partition
	 * @param innerGraph Internal graph
	 */
	public void setInnerGraph(Graph innerGraph) {
		this.innerGraph = innerGraph;
	}
	
	/**
	 * Add a node to the inner graph
	 * @param node Node
	 */
	public void addNode(Node node) {	
		this.innerGraph.addNode(node);
	}
	
	/**
	 * Add an edge to in inner graph
	 * @param edge Edge
	 */
	public void addEdge(Edge edge) {
		this.innerGraph.addEdge(edge);
	}
	
	/**
	 * Get the start node of the inner graph
	 * @return Start node
	 */
	@Override
	public Node getStartNode() {
		return this.innerGraph.getStartNode();
	}
	
	/**
	 * Get the end node of the inner graph
	 * @return
	 */
	@Override
	public Node getEndNode() {
		return this.innerGraph.getEndNode();
	}
}